/**
 * This view is an example list of people.
 */
Ext.define('OrderConvert.view.main.List', {
    extend: 'Ext.grid.Panel',
    xtype: 'mainlist',
    forceFit: true,

    requires: [
        'OrderConvert.store.Order',
        'OrderConvert.view.order.WatchOrderWin',
        'OrderConvert.view.main.MainModel',
        'OrderConvert.view.order.OrderWin'
    ],

    title: '订单列表',

    viewModel: {
        type : 'main'
    },
    bind: '{orderStore}',

    tbar: {
        xtype: 'toolbar',
        items: [
            {
                iconCls: 'x-fa fa-plus',
                text: '添加',
                handler : 'editOrder'
            },'-', {
                 iconCls : 'x-fa fa-file-pdf-o',
                text : '导出PDF',
                handler : 'exportPdf'
            },'-',{
                iconCls : 'x-fa fa-eye',
                text : '查看excel',
                handler : 'openXls'
            }, '-', {
                iconCls: 'x-fa fa-times',
                text: '删除',
                handler : 'delete'
            },'-',{
                iconCls: 'x-fa fa-fire',
                text : '使用转换规则',
                handler : 'useRule'
            },'-',{
                iconCls : 'x-fa fa-file-excel-o',
                text : '导出excel',
                handler : 'exportXls'
            },'-',{
                iconCls : 'x-fa fa-file-excel-o',
                text : '导出使用规则后的excel',
                handler : 'exportTmpXls'
            }]
    },

    columns: [
        { text: '编号', dataIndex: 'id', hidden: true },
        { text: '订单编号', dataIndex: 'orderCode', flex: 1 },
        { text: '订单名称', dataIndex: 'orderName', flex: 1 },
        { text: '添加人', dataIndex: 'createBy', flex: 1 },
        { text: '添加时间', dataIndex: 'createTime', flex: 1 },
        { text: '状态', dataIndex: 'isConvert', flex: 1,renderer : function(v){
          if(v == 'Y'){
              return "<span style='color : #5cb85c'>已转换</span>";
          }else{
              return "<span style='color : #d9534f'>未转换</span>";
          }   
        }},
        {text : '规则名称',dataIndex : 'ruleName',flex : 1,renderer : function (v) {
            return "<span style='color: #0f76c2'>"+v+"</span>";
        }},
        {text : '套用规则状态',hidden:true,dataIndex : 'ruleStatus',flex : 1,renderer : function (v) {
            if(v == 'Y'){
                return "<span style='color : #5cb85c'>已套用</span>";
            }else{
                return "<span style='color : #d9534f'>未套用</span>";
            }
        }}
    ],

    dockedItems: [{
        xtype: 'pagingtoolbar',
        bind: {
            store: '{orderStore}'
        },
        dock: 'bottom',
        displayInfo: true
    }]
});
